<script setup>
import { ref } from 'vue'

const newMsg = ref('son component01')
const printMsg = () => {
  console.log('method', newMsg.value)
}

// 默认子组件无法访问的属性和方法, 需要使用defineExpose暴露出去
defineExpose({
  newMsg,
  printMsg,
})
</script>

<template>
  <div class="component01">component02</div>
</template>

<style scoped>
.component01 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100px;
  width: 300px;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background-color: #f8f9fa;
  color: rgb(0, 191, 255);
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  position: relative;
  overflow: hidden;
}
</style>
